package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.query.QuestionAdminPageQuery;
import com.tianji.learning.service.IInteractionQuestionService;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;



/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author lcm
 * @since 2023-07-26
 */
@Api(tags = "管理端问题相关接口")
@Slf4j
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService iInteractionQuestionService;


    @GetMapping("/page")
    @ApiOperation("管理端分页查询")
    public PageDTO<QuestionAdminVO> adminPageQuery(@ApiParam("管理端问题分页参数") QuestionAdminPageQuery questionPageQuery){
        return iInteractionQuestionService.adminPageQuery(questionPageQuery);
    }

    @GetMapping("{id}")
    @ApiOperation("根据id查询问题详情")
    public QuestionAdminVO questionAdminDetails(@ApiParam("问题id") @PathVariable Long id){
        return iInteractionQuestionService.questionAdminDetails(id);
    }

    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("管理端隐藏问题或者显示问题")
    public void hiddenOrShowQuestion(@PathVariable Long id,@PathVariable Boolean hidden){
        iInteractionQuestionService.hiddenOrShowQuestion(id,hidden);
    }





}
